﻿namespace ExamV5.WorkExam
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Data;
    using System.Data.SqlClient;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;

    public class ShowPaperInfo : Page
    {
        protected Button butClose;
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private int int_0 = 0;
        protected Label labExamName;
        protected Label labInputTime;
        protected Label labInputUser;
        protected Label labJoinExamUser;
        protected Label labMemoDist;
        protected Label labPaperUseTime;
        protected Label labRubricDist;
        protected Label labSubjectName;
        private PublicFun publicFun_0 = new PublicFun();

        private void method_0()
        {
            try
            {
                SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["Conn"].ConnectionString);
                connection.Open();
                SqlCommand command = new SqlCommand("select * from WorkPaperInfo where ID=" + this.int_0, connection);
                SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection);
                if (reader.Read())
                {
                    this.labSubjectName.Text = reader["SubjectName"].ToString();
                    this.labExamName.Text = reader["ExamName"].ToString();
                    this.labRubricDist.Text = "测评试题:<font color='red'>" + reader["RubricDist"].ToString() + "</font>道";
                    this.labMemoDist.Text = "操作说明:" + reader["MemoDist"].ToString();
                    this.labPaperUseTime.Text = reader["PaperStartTime"].ToString() + "——" + reader["PaperEndTime"].ToString();
                    this.labInputUser.Text = reader["InputMan"].ToString();
                    this.labInputTime.Text = reader["InputTime"].ToString();
                }
                reader.Close();
                command.Dispose();
                connection.Close();
                connection.Dispose();
                this.labJoinExamUser.Text = this.publicFun_0.GetValues("select '['+UserCode+']'+UserName as UserName from UserInfo where UserCode in(select UserCode from WorkExamUser where PaperID=" + this.int_0 + ")");
            }
            catch
            {
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            this.int_0 = Convert.ToInt32(base.Request["ID"].ToString());
            if ((this.httpCookie_0 != null) && !(this.httpCookie_0.Value == ""))
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                if (!base.IsPostBack)
                {
                    this.Page.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString;
                    if (!(this.publicFun_0.ReturnPaperData() != "Yes"))
                    {
                        if (!((this.int_0 != 0) ? !(this.httpCookie_2.Value != "A") : true))
                        {
                            this.method_0();
                        }
                    }
                    else
                    {
                        base.Response.Write("<script>alert('此版本暂未授权,请拔打(0)13870606104手机号进行授权！')</script>");
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

